/**
 * DownloadCallback.java
 * 
 * Create Version: 1.0
 * Author: 徐舟骏
 * Create Date: 2012-5-9
 */
package ysyh55.android.base.util;

import java.util.Map;

/**
 * DownloadCallback 下载完成回调类
 * 
 * @author 徐舟骏
 */
public class DownloadCallback {
	private String url;
	private String savePath;
	private Callback callback;
	private Map<String, String> params;

	public DownloadCallback(String url, String savePath, Callback callback) {
		this.url = url;
		this.savePath = savePath;
		this.callback = callback;
	}

	public DownloadCallback(String url, String savePath, Callback callback, Map<String, String> params) {
		this.url = url;
		this.savePath = savePath;
		this.callback = callback;
		this.params = params;
	}

	/**
	 * 执行回调方法
	 * 
	 * @param savePath
	 */
	public void doCallback() {
		this.callback.doCallback(this.savePath);
	}

	/**
	 * @return 字段 url 的值
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * @return 字段 savePath 的值
	 */
	public String getSavePath() {
		return savePath;
	}

	/**
	 * @return 字段 params 的值
	 */
	public Map<String, String> getParams() {
		return params;
	}

	/**
	 * 
	 * Callback 回调方法
	 * 
	 * @author 徐舟骏
	 */
	public interface Callback {
		/**
		 * 执行回调方法
		 * 
		 * @param savePath
		 */
		void doCallback(String savePath);
	}
}
